﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MyAdmin/QuanLy.master" AutoEventWireup="true"
    CodeFile="SanPham_AM.aspx.cs" Inherits="MyAdmin_SanPham_AM" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <fieldset>
    <legend align="center"><b>Tìm Kiếm</b></legend>
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    	<tr>
    		<td align="center">
               <table>
            <tr>
                <td>
                    <strong>Tên Sản Phẩm</strong>
                </td>
                <td>
                    <asp:TextBox ID="tenSPTEXT" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Giá Từ</strong>
                </td>
                <td>
                    <asp:TextBox ID="giaTuTEXT" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Giá Đến</strong>
                </td>
                <td>
                    <asp:TextBox ID="giaDenTEXT" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="timBUTTON" runat="server" Text="Tìm Kiếm" OnClick="btnTimKiem_NCCGH_Click" />
                </td>
            </tr>
        </table>
            </td>
    	</tr>
    </table>
     
    </fieldset>
    <fieldset>
        <asp:Label ID="lblTBKhongTimThay" ForeColor="White" runat="server" Visible="false"
            Text="Không tìm thấy sản phẩm nào!"></asp:Label>
        <legend align="center"><b>Quản Lý Sản Phẩm</b></legend>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr>
                <td align="center">
                    <asp:DetailsView ID="dtChiTietGiangHang" runat="server" Height="50px" Width="40%"
                        BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
                        CellPadding="3" DataKeyNames="ID" HeaderText="Chi Tiết Sản Phẩm" AutoGenerateRows="False"
                        OnItemInserted="dtChiTietGiangHang_ItemInserted" OnItemUpdated="dtChiTietGiangHang_ItemUpdated"
                        Style="margin-left: 0px" DataSourceID="LQDSNCC_GiangHang" 
                        GridLines="Vertical">
                        <AlternatingRowStyle BackColor="#DCDCDC" />
                        <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                        <Fields>
                            <asp:BoundField HeaderText="ID" ReadOnly="true" DataField="ID" InsertVisible="False"
                                SortExpression="ID" />
                            <asp:BoundField DataField="Name" HeaderText="Tên" SortExpression="Name" />
                            <asp:TemplateField HeaderText="Loại SP">
                                <ItemTemplate>
                                    <asp:Label ID="lblLSPNXBTenCLSP" runat="server" Text='<%# Eval("TenLSP") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtLSPNXBTenCLSP" Visible="false" runat="server" ReadOnly="true"
                                        Text='<%# Bind("CategoryID") %>' />
                                    <asp:DropDownList ID="cbbLSPNXBLSP" runat="server" AutoPostBack="True" OnDataBound="cbbLSPLSP_DataBound"
                                        OnSelectedIndexChanged="cbbLSPLSP_SelectedIndexChanged" DataSourceID="LSP_LINQ"
                                        DataTextField="Name" DataValueField="ID">
                                    </asp:DropDownList>
                                    <asp:LinqDataSource ID="LSP_LINQ" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
                                        EntityTypeName="" Select="new (Name, ID)" TableName="Categories">
                                    </asp:LinqDataSource>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Decription" HeaderText="Mô Tả" 
                                SortExpression="Decription" />
                            <asp:TemplateField HeaderText="Hình">
                                <ItemTemplate>
                                    <asp:Label ID="hinhLABEL" runat="Server" Text='<%# Eval("Image") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lblUpdloadForEdit" runat="server" Text="Upload Hình:" ForeColor="White"></asp:Label>
                                    <asp:FileUpload ID="fuForEdit" runat="server" />
                                    <asp:Button ID="btnUploadForEdit" runat="server" Text="Upload" OnClick="btnUploadForEdit_Click" />
                                    <asp:TextBox ID="txtUploadForEdit" ReadOnly="true" Text='<%# Bind("Image") %>' runat="server"></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="RetailPrice" HeaderText="Giá" 
                                SortExpression="RetailPrice" />
                            <asp:BoundField DataField="TotalQuantity" HeaderText="SL Tồn" 
                                SortExpression="TotalQuantity" />
                            <asp:TemplateField HeaderText="Ngày Nhập">
                                <ItemTemplate>
                                    <asp:Label ID="ngayCapNhatSauCungLABEL" runat="Server" Text='<%# Eval("ImportDate", "{0:d}") %>' />
                                </ItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Calendar ID="ngayCapNhatSauCungInsertCALENDAR" runat="Server" SelectedDate='<%# Bind("ImportDate") %>' />
                                </InsertItemTemplate>
                                <EditItemTemplate>
                                    <asp:Calendar ID="ngayCapNhatSauCungUpdateCALENDAR" runat="Server" VisibleDate='<%# Eval("ImportDate") %>'
                                        SelectedDate='<%# Bind("ImportDate") %>' />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="MinQuant" HeaderText="SL Tối Thiểu" 
                                SortExpression="MinQuant" />
                            <asp:BoundField DataField="ChieuDai" HeaderText="Chiều Dài" 
                                SortExpression="ChieuDai" />
                            <asp:BoundField DataField="ChieuRong" HeaderText="Chiều Rộng" 
                                SortExpression="ChieuRong" />
                            <asp:BoundField DataField="KhoiLuong" HeaderText="Khối Lượng" 
                                SortExpression="KhoiLuong" />
                            <asp:TemplateField HeaderText="Tác Giả">
                                <ItemTemplate>
                                    <asp:Label ID="lblTenCLSP" runat="server" Text='<%# Eval("TenTG") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtTenCLSP" Visible="false" runat="server" ReadOnly="true" Text='<%# Bind("MaTacGia") %>' />
                                    <asp:DropDownList ID="cbbLSP" runat="server" AutoPostBack="True" OnDataBound="cbbLSP_DataBound"
                                        OnSelectedIndexChanged="cbbLSP_SelectedIndexChanged" DataSourceID="TacGia_LINQ"
                                        DataTextField="Ten" DataValueField="ID">
                                    </asp:DropDownList>
                                    <asp:LinqDataSource ID="TacGia_LINQ" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
                                        EntityTypeName="" Select="new (ID, Ten)" TableName="TacGias">
                                    </asp:LinqDataSource>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Nhà XB">
                                <ItemTemplate>
                                    <asp:Label ID="lblNXBTenCLSP" runat="server" Text='<%# Eval("TenNXB") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtNXBTenCLSP" Visible="false" runat="server" ReadOnly="true" Text='<%# Bind("MaNhaXB") %>' />
                                    <asp:DropDownList ID="cbbNXBLSP" runat="server" AutoPostBack="True" OnDataBound="cbbNXBLSP_DataBound"
                                        OnSelectedIndexChanged="cbbNXBLSP_SelectedIndexChanged" DataSourceID="NXB_LINQ"
                                        DataTextField="Ten" DataValueField="ID">
                                    </asp:DropDownList>
                                    <asp:LinqDataSource ID="NXB_LINQ" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
                                        EntityTypeName="" Select="new (ID, Ten)" TableName="NhaXuatBans">
                                    </asp:LinqDataSource>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:CheckBoxField DataField="DaXoa" HeaderText="Đã Xóa" 
                                SortExpression="DaXoa" />
                            <asp:TemplateField HeaderText="Download Link">
                                <ItemTemplate>
                                    <asp:Label ID="DLhinhLABEL" runat="Server" Text='<%# Eval("DownloadLink") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="lblDLUpdloadForEdit" runat="server" Text="Upload Hình:" ForeColor="White"></asp:Label>
                                    <asp:FileUpload ID="fuDLForEdit" runat="server" />
                                    <asp:Button ID="btnDLUploadForEdit" runat="server" Text="Upload" OnClick="btnUploadForDownLoadLink_Click" />
                                    <asp:TextBox ID="txtDLUploadForEdit" ReadOnly="true" Text='<%# Bind("DownloadLink") %>'
                                        runat="server"></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" 
                                CancelText="Hủy" EditText="Cập Nhật" InsertText="Thêm" NewText="Thêm" 
                                UpdateText="Cập Nhật" />
                        </Fields>
                        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
                        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EEEEEE" ForeColor="Black" HorizontalAlign="Left" />
                    </asp:DetailsView>
                    <asp:Label runat="server" Text="Label" ID="lblThongBaoDTView" ForeColor="White" Visible="false" />
                </td>
            </tr>
        </table><br />
        <asp:GridView ID="gvDSNCC_GiangHang" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            DataKeyNames="ID" BackColor="White" BorderColor="#999999" BorderStyle="None"
            BorderWidth="1px" CellPadding="3" GridLines="Vertical" Width="100%" OnSelectedIndexChanged="gvDSNCC_GiangHang_SelectedIndexChanged"
            OnPageIndexChanging="gvDSNCC_GiangHang_PageIndexChanging">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" SelectText="Chọn" />
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="ID" />
                <asp:ImageField DataImageUrlFormatString="~/images/SanPham/{0}" 
                    DataImageUrlField="Image" HeaderText="Hình">
                    <ControlStyle Height="100px" Width="100px" />
                </asp:ImageField>
                <asp:BoundField DataField="Name" HeaderText="Tên" SortExpression="Name" />
                <asp:BoundField DataField="TenLSP" HeaderText="Loại SP" 
                    SortExpression="TenLSP" />
                <asp:BoundField DataField="Decription" HeaderText="Mô Tả" SortExpression="Decription"
                    Visible="False" />
                <asp:BoundField DataField="RetailPrice" HeaderText="Giá" 
                    SortExpression="RetailPrice" />
                <asp:BoundField DataField="TotalQuantity" HeaderText="SL Tồn" 
                    SortExpression="TotalQuantity" />
                <asp:BoundField DataField="ImportDate" HeaderText="Ngày Nhập" 
                    SortExpression="ImportDate" />
                <asp:BoundField DataField="MinQuant" HeaderText="SL Tối Thiểu" 
                    SortExpression="MinQuant" />
                <asp:BoundField DataField="ChieuDai" HeaderText="Chiều Dài" SortExpression="ChieuDai"
                    Visible="False" />
                <asp:BoundField DataField="ChieuRong" HeaderText="Chiều Rộng" SortExpression="ChieuRong"
                    Visible="False" />
                <asp:BoundField DataField="KhoiLuong" HeaderText="Khối Lượng" SortExpression="KhoiLuong"
                    Visible="False" />
                <asp:BoundField DataField="TenTG" HeaderText="Tên TG" SortExpression="TenTG" />
                <asp:BoundField DataField="TenNXB" HeaderText="Tên NXB" 
                    SortExpression="TenNXB" />
                <asp:CheckBoxField DataField="DaXoa" HeaderText="Đã Xóa" 
                    SortExpression="DaXoa" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:CheckBox ID="checkXoa" runat="server" AutoPostBack="True" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#0000A9" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#000065" />
        </asp:GridView>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr>
                <td align="right">
                    <asp:Label ID="lblThongBaoGridView" runat="server" ForeColor="White" Text="Label"></asp:Label>
                    <asp:Button ID="XoaNhieuBUTTON" runat="server" Text="Xóa Đã Chọn" OnClick="XoaNhieuBUTTON_Click" />
                </td>
            </tr>
        </table>
        <asp:LinqDataSource ID="LQDSNCC_GiangHang" runat="server" ContextTypeName="DataAccess_Layer.DataClasses_RetailerDataContext"
            EntityTypeName="" TableName="Products" OnSelecting="LQDSNCC_GiangHang_Selecting"
            OnUpdating="LQDSNCC_GiangHang_Updating" OnInserted="LQDSHoaDon_AM_Inserted" EnableInsert="True"
            EnableUpdate="True">
        </asp:LinqDataSource>
        <br />
    </fieldset>
</asp:Content>
